package com.bitcat.firstapp.demo.tablayoutdemo

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.bitcat.firstapp.databinding.FragmentContentBinding

class TabContentFragment:Fragment() {

    //意味着放弃空安全，
    private lateinit var binding:FragmentContentBinding

//    private var binding:FragmentContentBinding? = null

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        binding = FragmentContentBinding.inflate(inflater,container,false)
        val title = arguments?.getString("title")
        title?.let { binding. contentTv.text = it}
        return binding.root
    }

    companion object{


        fun newInstance(title:String):Fragment{
            val fragment = TabContentFragment()

            val bundle = Bundle()
            bundle.putString("title",title)
            fragment.arguments = bundle
            return fragment
        }
    }
}